package fr.noe.amicaleloisirs.concours.utils;

import java.util.Date;

import com.google.gwt.i18n.client.DateTimeFormat;

public class DateUtil {
	
	private static final int TODAY = 0;
	private static final int YESTERDAY = -1;

	public static String createDateToday() {
		return createDate(TODAY);
	}
	
	public static String createDateYesterday() {
		return createDate(YESTERDAY);
	}
	
	private static String createDate(int offset) {
		long toOffset = offset * 24 * 60 * 60 * 1000;
		Date today = new Date(System.currentTimeMillis() + toOffset);
		DateTimeFormat formatter = DateTimeFormat.getFormat("dd-MM-yyyy");
		return formatter.format(today);
	}

}
